extends AnimatedSprite2D

@export var tag = "子弹"
var speed = 100
var x = 0
@export var atk = 3
var player
var lifeTime = 10
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	RemoveDm.adddm(self)
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta: float) -> void:
	position.y = position.y - speed
	position.x +=x 
	lifeTime -= delta
	if lifeTime<0:
		endself()
	pass
	



func _on_area_2d_body_entered(body: Node2D) -> void:
	
	if body.has_method("被打"):
		body.被打(player,self)
		#var 爆炸特效
		#get_parent().add_child(爆炸特效)
		#爆炸特效.position = position
		
		endself()
	
	pass # Replace with function body.
func endself():
	RemoveDm.delDm(self)
	queue_free()
